<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>TodoList</h1>
        <input type="text">
    </div>
    <script>
        var app = document.getElementById("app")
        var input = document.querySelector("input");
       var arr = []
        input.onkeyup = function(e){
            var value = this.value;
            if(e.keyCode==13&&value!=""){
                var p = document.createElement("p");
                if(arr.includes(this.value)) return ;
                arr.push(this.value)
                p.innerHTML = value;
                this.value = "";
                app.appendChild(p);
                var todos = document.querySelectorAll("#app>p");
                todos.forEach((item)=>{
                    item.onclick = function(){
                        app.removeChild(item)
                    }
                })
            }
        }
    </script>
</body>
</html>